<?php
namespace Admin\Controller;

use Admin\Util\lib\API;
use Admin\Util\lib\YZTokenClient;
use Util\AccessController;
use Admin\Util\lib\YouZanApiFunction;

class BlackBookController extends AccessController {


    public function Index() {
        $files = C('BLACK_BOOK_ADMIN_LS');
        $LS = Service('M', 'book');
        $DATA = $LS->query(array('IS_BLACK' => 1), null, $files);
        $this->DATA = $DATA;
        $this->display();
    }

    //移除黑名单
    public function Del() {
        $LS = Service('M', 'book');
        $where['ID'] = $_GET['ID'];
        $save['IS_BLACK'] = 0;
        $OK = $LS->update($where, $save);
        $OK ? $this->success('移除成功') : $this->error('移除失败');
    }

    //加入黑名单
    public function Add() {
        $LS = Service('M', 'book');
        $where['ID'] = $_POST['ID'];
        $save['IS_BLACK'] = $_POST['num'];
        $OK = $LS->update($where, $save);
        echo $OK;
    }


}